---
title: "Disconnect Server"
description: "Disconnect Server API Documentation"
icon: "code"
github: "https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/agents/managers/tools/disconnect_server.py"
---

import {RandomGradientBackground} from "/snippets/gradient.jsx"

<Callout type="info" title="Source Code">
View the source code for this module on GitHub: <a href='https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/agents/managers/tools/disconnect_server.py' target='_blank' rel='noopener noreferrer'>https://github.com/mcp-use/mcp-use/blob/main/libraries/python/mcp_use/agents/managers/tools/disconnect_server.py</a>
</Callout>

## DisconnectServerInput

<div>
<RandomGradientBackground className="rounded-lg p-4 w-full h-full rounded-full">
<div className="text-black">
<div className="text-black font-bold text-xl mb-2 mt-8"><code className="!text-black">class</code> DisconnectServerInput</div>

Empty input for disconnecting from the current server

</div>
</RandomGradientBackground>
```python
from mcp_use.agents.managers.tools.disconnect_server import DisconnectServerInput
```

<Card type="info">
### `method` __init__

Create a new model by parsing and validating input data from keyword arguments.

        Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
        validated to form a valid model.

        `self` is explicitly positional-only to allow `self` as a field name.

**Parameters**
><ParamField body="data" type="Any" required="True" >   Parameter value </ParamField>

**Signature**
```python wrap
def __init__(data: Any):
```

</Card>
</div>

## DisconnectServerTool

<div>
<RandomGradientBackground className="rounded-lg p-4 w-full h-full rounded-full">
<div className="text-black">
<div className="text-black font-bold text-xl mb-2 mt-8"><code className="!text-black">class</code> DisconnectServerTool</div>

Tool for disconnecting from the currently active MCP server.

</div>
</RandomGradientBackground>
```python
from mcp_use.agents.managers.tools.disconnect_server import DisconnectServerTool
```

<Card type="info">
**Attributes**
>
<ParamField body="name" type="ClassVar" required="True" >   Name identifier </ParamField>
<ParamField body="description" type="ClassVar" required="True" >   Parameter value </ParamField>
<ParamField body="args_schema" type="ClassVar" required="True" >   Parameter value </ParamField>

</Card>

<Card type="info">
### `method` __init__

Initialize with server manager.

**Parameters**
><ParamField body="server_manager" required="True" >   Server name or configuration </ParamField>

**Signature**
```python wrap
def __init__(server_manager):
```

</Card>
</div>
